import { request } from '@umijs/max';

export class RequestServiceProxy {
  // 封装get请求
  get<T>(url: string): Promise<T> {
    return request<T>(url, { method: 'GET' });
  }

  // 封装post请求
  post<T>(url: string, data?: any): Promise<T> {
    return request<T>(url, {
      method: 'POST',
      data: {
        ...data,
      },
    });
  }
  delete<T>(url: string, data?: any): Promise<T> {
    return request<T>(url, {
      method: 'DELETE',
      data: {
        ...data
      }
    })
  }
}
